#define _CRT_SECURE_NO_WARNINGS 1
#include<stdlib.h>
#include<stdio.h>

int main()
{
	char* str = NULL;
	int def = 5;
	str = (char*)malloc(def * sizeof(char));
	if (NULL == str)
	{
		perror("malloc");
		return 1;
	}
	int i = 0;
	while (scanf("%c", str + i) == 1 && *(str+i) != '\n')
	{
		i++;
		if (i == def)
		{
			def += 2;
			char* ptr = realloc(str, def * sizeof(char));
			if (ptr == NULL)
			{
				perror("realloc");
				return 1;
			}
			str = ptr;
		}
	}
	*(str + i) = '\0';
	printf("%s\n", str);
	free(str);
	str = NULL;
	return 0;
}